﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddresList.ascx.cs" Inherits="Shop.Web.Controls.Ajax.AddresList" %>
<div>
<asp:Repeater runat="server" ID="rprAddressList">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
    <input onclick="$('#hdnAddr').val(this.value)" type="radio" name="addr" value='<%# DataBinder.Eval(Container, "DataItem.Id")%>' id='<%# DataBinder.Eval(Container, "DataItem.Id")%>'/> <%# DataBinder.Eval(Container, "DataItem.Name")%><br/>
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:Repeater>
<input type="hidden" Value="<%= DftAddres %>" id="hdnAddr"/>
<a class="dialog_link" path="#addres" title="Адрес" >добавить новый адрес</a>
<script type="text/javascript">

    
    function setRadioGroupValue(val) {
        radioGroupObj = document.getElementsByName("addr");
        for (var i = 0; i < radioGroupObj.length; i++)
            if (radioGroupObj[i].value == val) {
                radioGroupObj[i].checked = true;
                return radioGroupObj[i].value;
        }
        return null;
    }
    
    setRadioGroupValue(<%= DftAddres %>);
    
    function getRadioGroupValue() {
        radioGroupObj = document.getElementsByName("addr");
        for (var i = 0; i < radioGroupObj.length; i++)
            if (radioGroupObj[i].checked) {
            return radioGroupObj[i].value;
        }
        return null;
    }
</script>
</div>
